<!--- <cfparam name="PA_ID" type="integer" default="0" /> --->
<cfparam name="returnView" type="string" default="" />
<cfparam name="passback" type="string" default="" />

<cfscript>
	userGateway = new assets.calgrants.com.gateway.UserGateway();
	siteGateway = new assets.calgrants.com.gateway.SiteGateway();
	organizationGateway = new assets.calgrants.com.gateway.OrganizationGateway();
	countyGateway = new assets.calgrants.com.gateway.CountyGateway();
	users = userGateway.query(Organization_ID = request.authUser.organizationID);
	sites = siteGateway.query(Organization_ID = request.authUser.organizationID);
	organization = organizationGateway.get(Organization_ID = request.authUser.organizationID);
	county = countyGateway.get(County_ID = organization.getCounty_ID());
</cfscript>

<script type="text/javascript" language="javascript">
<!--		
	/*var confirmReject = function() {
		if (confirm("Acceptance of this Partnership Agreement is a requirement for participation in the Cash for College program.  If you choose not to accept this agreement you will be logged out of this system.  You will be able to login again and chose to accept this agreement.\n\nAre you sure you want to reject this Partnership Agreement?")) {
			return true;
		} else {
			return false;
		}
	}*/
	$(function() {
		$("#organizationUsersSites").modal();
		resizeModal("organizationUsersSites");	
	})
//-->
</script>

<cfoutput>

		
	<div id="organizationUsersSites" class="modal modal-fullscreen" data-backdrop="static">
		<div class="modal-header">
			<h3>Organization, Users and Sites</h3>
		</div>
		<div class="modal-body">
			<div class="container-fluid">
				<div class="row-fluid">
					<div class="span12">
						<h3>Organization</h3>
						<div class="well">
							#organization.getOrganization()#<br />
							#organization.getAddress()#<br />
							#organization.getCity()#, CA #organization.getZip_Code()#<br />
							#county.getCounty()# County<br />
						</div>
						<a href="?view=editOrganization&returnView=#view#&Organization_ID=#organization.getOrganization_ID()#" class="btn btn-success">Edit</a>
						<h3>Users</h3>
						<p><a href="?view=editUser&returnView=#view#&User_ID=0" class="btn btn-success">New User</a></p>
						<cfif users.RecordCount gt 0>
							<table class="table table-striped table-bordered">
								<thead>
									<tr>
										<th>Name</th>
										<th>Role</th>
										<th>E-mail</th>
										<!--- <th>Workshops</th>
										<th>Orders</th> --->
										<th>Status</th>
										<th class="action"></th>
									</tr>
								</thead>
								<tbody>
									<cfloop query="users">
										<tr>
											<td>#First_Name# #Last_Name#</td>
											<td>#Role#</td>
											<td><a href="mailto:#Email#">#Email#</a></td>
											<!--- <td>#Workshop_Count#</td>
											<td>#Order_Count#</td> --->
											<td>
												<cfif Deleted>
													<font color="red">Deleted</font>
												<cfelseif Archived>
													<font color="silver">Archived</font>
												<cfelseif NOT Approved>
													<font color="orange">Not Approved</font>
												<cfelseif Approved>
													Approved
												</cfif>
											</td>
											<td><a href="?view=editUser&returnView=#view#&User_ID=#User_ID#" class="btn btn-success btn-block">Edit</a></td>
										</tr>
									</cfloop>
								</tbody>
							</table>
							
						<cfelse>
							<div class="alert alert-info notFound">No users</div>
						</cfif>
						
						<h3>Sites</h3>
						<p><a href="?view=editSite&returnView=#view#&Site_ID=0" class="btn btn-success">New Site</a></p>
						<cfif sites.RecordCount gt 0>
							<table class="table table-striped table-bordered">
								<thead>
									<tr>
										<th>Site</th>
										<th>Site Type</th>
										<th>Address</th>
										<!--- <th>City</th>
										<th>Zip Code</th> --->
										<th>County</th>
										<th>Computers</th>
										<th class="action"></th>
									</tr>
								</thead>
								<tbody>
									<cfloop query="sites">
										<tr valign="top">
											<td>#Site#</td>
											<td>#Site_Type#</td>
											<td>#Address#<br />#City#, CA #Zip_Code#</td>
											<td>#County#</td>
											<td>#Computers#</td>
											<td><a href="?view=editSite&returnView=#view#&Site_ID=#Site_ID#" class="btn btn-success btn-block">Edit</a></td>
										</tr>
									</cfloop>
								</tbody>
							</table>
							
						<cfelse>
							<div class="alert alert-info notFound">No sites</div>
						</cfif>
					</div>
				</div>
			</div>
		</div>
		<div class="modal-footer">
			<a href="?view=workshops" class="btn btn-success">Finished</a>
		</div>
	</div>

</cfoutput>